@@ -1499,8 +1499,31 @@ Check the :confval:`latex_table_style`.
1499
1499
using ``tabulary `` is that it tries to compute automatically (internally to
1500
1500
LaTeX) suitable column widths.
1501
1501
1502
- :rst:dir: `tabularcolumns ` can serve to provide one's own "colspec" choice.
1503
- Here is an advanced example:
1502
+ The ``tabulary `` algorithm often works well, but in some cases when a cell
1503
+ contains long paragraphs, the column will be given a large width and other
1504
+ columns whose cells contain only single words may end up too narrow. The
1505
+ :rst:dir: `tabularcolumns ` can help solve this via providing to LaTeX a
1506
+ custom "alignment preamble" (aka "colspec"). For example ``lJJ `` will be
1507
+ suitable for a three-columns table whose first column contains only single
1508
+ words and the other two have cells with long paragraphs.
1509
+
1510
+ .. note ::
1511
+
1512
+ Of course, a fully automated solution would be better, and it is still
1513
+ hoped for, but it is an intrinsic aspect of ``tabulary ``, and the latter
1514
+ is in use by Sphinx ever since ``0.3 ``... It looks as if solving the
1515
+ problem of squeezed columns could require substantial changes to that
1516
+ LaTeX package. And no good alternative appears to exist, as of 2025.
1517
+
1518
+ .. hint ::
1519
+
1520
+ A way to solve the issue for all tables at once, is to inject in the
1521
+ LaTeX preamble (see :confval: `latex_elements `) a command such as
1522
+ ``\setlength{\tymin}{1cm} `` which causes all columns to be at least
1523
+ ``1cm `` wide (not counting inter-column whitespace). Currently, Sphinx
1524
+ configures ``\tymin `` to allow room for three characters at least.
1525
+
1526
+ Here is a more sophisticated "colspec", for a 4-columns table:
1504
1527
1505
1528
.. code-block :: latex
1506
1529
0 commit comments